package entityJPA;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The persistent class for the positionstatus database table.
 * 
 */
@Entity
@Table(name="positionstatus")
@NamedQuery(name="Positionstatus.findAll", query="SELECT p FROM Positionstatus p")
public class Positionstatus implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(unique=true, nullable=false)
	private int idPositionStatus;

	@Column(nullable=false, length=45)
	private String value;

	//bi-directional many-to-one association to Position
	@OneToMany(mappedBy="positionstatus")
	private List<Position> positions;

	public Positionstatus() {
	}

	public int getIdPositionStatus() {
		return this.idPositionStatus;
	}

	public void setIdPositionStatus(int idPositionStatus) {
		this.idPositionStatus = idPositionStatus;
	}

	public String getValue() {
		return this.value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public List<Position> getPositions() {
		return this.positions;
	}

	public void setPositions(List<Position> positions) {
		this.positions = positions;
	}

	public Position addPosition(Position position) {
		getPositions().add(position);
		position.setPositionstatus(this);

		return position;
	}

	public Position removePosition(Position position) {
		getPositions().remove(position);
		position.setPositionstatus(null);

		return position;
	}

}